# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=songrec
pkgver=0.3.3
pkgrel=0
pkgdesc="Open-source Shazam client for Linux"
url="https://github.com/marin-m/SongRec"
# s390x fails to build
# riscv64: rust broken
arch="all !s390x !riscv64"
license="GPL-3.0-only"
makedepends="
	alsa-lib-dev
	cargo
	cargo-auditable
	gdk-pixbuf-dev
	glib-dev
	gtk+3.0-dev
	openssl-dev>3
	pango-dev
	"
source="https://github.com/marin-m/songrec/archive/$pkgver/songrec-$pkgver.tar.gz
	getrandom-0.2.10.patch
	"
# net required to download Rust dependencies
# no tests
options="net !check"
builddir="$srcdir/SongRec-$pkgver"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/songrec -t "$pkgdir"/usr/bin/
	mv packaging/rootfs/usr/share "$pkgdir"/usr
}

sha512sums="
bd3bfa6b8549fd2444acdd6631adae511b8c64a644d4bf47e32174f24455d426cdfad68b0f555488d8a18038431702066d521beb0985bd7fff1284d5c319fb3c  songrec-0.3.3.tar.gz
c5b082ced0b66d6451435901e2bffc82afa38c25b44eac7ad45032caece86d7297af02257904594f850900775a3a17946a21cce606cc4df3cae23f8a43695321  getrandom-0.2.10.patch
"
